<template>
  <div id="lightlesson">
    <div>
      <!-- 顶部导航 -->
      <Navbar :title="title" />
      <!-- 什么是轻课组件 -->
      <WhatIsLightLesson v-if="whatislightlesson.maxTitle" :lightlesson="whatislightlesson" style="margin:46px 0 35px;" />
      <!-- 课程同步组件 -->
      <SyncLesson v-if="synclesson.maxTitle" :synclesson="synclesson" />
      <!-- 面授同步班 -->
      <FacetoFace v-if="facetoface.maxTitle" :facetoface="facetoface"/>
      <!-- 免费试听课程` -->
      <FreeVideo v-if="player.maxTitle" :player="player"/>
        <!-- 线下教学实拍 -->
      <OfflineTeaching v-if="offlineteach.maxTitle" :offlineTeach="offlineteach" />
        <!-- 我的同学 -->
      <MyClassmate  v-if="myclassmate_info.maxTitle" :info="myclassmate_info" />
      <!-- 卡片展示教师 -->
      <Teacher v-if="teacherinfo.maxTitle" :teacherinfo="teacherinfo" />
      <!-- 教学大纲 -->
      <Outline v-if="outlineinfo.maxTitle" :stepInfo="outlineinfo" />
      <!-- 测试自己 -->
      <Test v-if="testinfo.maxTitle" :testinfo="testinfo"/>
        <!-- 问题 -->
      <Question  v-if="datainfos.length" :dataInfos="datainfos"/>
          <!-- 二维码 -->
      <ORcode v-if="orcode._id" :ORcode="orcode"/>
    </div>
  </div>
</template>

<script>
import Navbar from "../../components/Navbars/Navbar/Navbar";
import WhatIsLightLesson from "../../components/LightLesson/WhatIsLightLesson";
import SyncLesson from "../../components/LightLesson/SyncLesson";
import FacetoFace from "../../components/LightLesson/FacetoFace";
import FreeVideo from "../../components/LightLesson/FreeVideo";
import OfflineTeaching from "../../components/LightLesson/OfflineTeaching";
import MyClassmate from "../../components/LightLesson/MyClassmate";
import Teacher from "../../components/LightLesson/Teacher";
import Outline from "../../components/LightLesson/Outline";
import Test from "../../components/LightLesson/Test";
import Question from "../../components/LightLesson/Question";
import ORcode from "../../components/LightLesson/ORcode";

import { Row, Col } from "view-design";


import {mapActions,mapState} from 'vuex';
export default {
  name: "lightlesson",
  components: {
    Navbar,
    Row,
    Col,
    WhatIsLightLesson,
    SyncLesson,
    FacetoFace,
    FreeVideo,
    OfflineTeaching,
    MyClassmate,
    Teacher,
    Outline,
    Test,
    Question,
    ORcode
  },
  data() {
    return {
      title: "路飞学城",

    
    };
  },
  //从Vuex中获取数据
  computed: mapState({
    //什么是轻课
    whatislightlesson(state){
      return state.whatislightlesson;
    },
    //同步课程
    synclesson(state){
      return state.synclesson;
    },
    facetoface(state){
      return state.facetoface;
    },
    player(state){
      return state.player;
    },
    offlineteach(state){
      return state.offlineteach;
    },
    myclassmate_info(state){
      return state.myclassmate_info;
    },
    teacherinfo(state){
      return state.teacherinfo;
    },
    outlineinfo(state){
      return state.outlineinfo;
    },
    testinfo(state){
      return state.testinfo;
    },
    datainfos(state){
      return state.datainfos;
    },
    orcode(state){
      return state.orcode;
    },
  }),
  watch: {},
  //vuex函数注册
  methods: {
    ...mapActions(['reqServerData'])
  },
  created() {},
  mounted() {
    //什么是轻课数据获取
    let params ={
      method:'get',
      methodName:'WhatIsLightlesson',
      param:[]
    }
    this.reqServerData(params);
    //同步课程数据获取
    params ={
      method:'get',
      methodName:'Synclesson',
      param:[]
    }
    this.reqServerData(params);
    //面授同步班数据获取
    params ={
      method:'get',
      methodName:'Facetoface',
      param:[]
    }
    this.reqServerData(params);

    //免费课程试听
    params ={
      method:'get',
      methodName:'Player',
      param:[]
    }
    this.reqServerData(params);

    //线下教学实拍
    params ={
      method:'get',
      methodName:'Offlineteach',
      param:[]
    }
    this.reqServerData(params);

    //我的同学
    params ={
      method:'get',
      methodName:'Myclassmate_info',
      param:[]
    }
    this.reqServerData(params);

    //卡片展示教师
    params ={
      method:'get',
      methodName:'Teacherinfo',
      param:[]
    }
    this.reqServerData(params);

    //教学大纲
    params ={
      method:'get',
      methodName:'Outlineinfo',
      param:[]
    }
    this.reqServerData(params);


    //教学大纲
    params ={
      method:'get',
      methodName:'Testinfo',
      param:[]
    }
    this.reqServerData(params);

    //教学大纲
    params ={
      method:'get',
      methodName:'Datainfos',
      param:[]
    }
    this.reqServerData(params);

    //二维码
    params ={
      method:'get',
      methodName:'Orcode',
      param:[]
    }
    this.reqServerData(params);

    // 插入数据测试
    //   params ={
    //   method:'post',
    //   methodName:'insertOrcode',
    //   param:[{
    //     img: "../../../static/LightLesson/image/orcode/ORcode.jpg",
    //     line:
    //       '微信扫一扫,<br />找<span style="color:red;font-size:14px;font-weight:900">杨帅</span>了解详情吧~'
    //   }]
    // }

    //this.reqServerData(params);
  },
  beforeCreate() {}, //生命周期 - 创建之前
  beforeMount() {}, //生命周期 - 挂载之前
  beforeUpdate() {}, //生命周期 - 更新之前
  updated() {}, //生命周期 - 更新之后
  beforeDestroy() {}, //生命周期 - 销毁之前
  destroyed() {}, //生命周期 - 销毁完成
  activated() {} //如果页面有keep-alive缓存功能，这个函数会触发
};
</script>

<style scoped>
</style>